#ifndef RULEBASE_H
#define RULEBASE_H

#include <QString>
#include "condition.h"
#include "ruleformula.h"
#include <QVector>

struct RuleResult
{
    RuleResult(int id,QString name)
    {
        this->id = id;
        this->name = name;
        this->result = true;
    }

    int id;
    bool result;
    QString name;
    QVector<ConditionResult> conditionResults;
};

class RuleBase
{
public:
    RuleBase();
    ~RuleBase();
    void SetRuleID(int id){m_nID = id;};
    int GetRuleID(){return m_nID;};
    void SetName(QString name);
    QString GetName(){return m_sName;};
    void AddConditon(Condition* condition);
    RuleResult Run(QString entityName);
    void AddFormula(RuleFormula* ruleFormula);
private:
    int m_nID;
    QString m_sName;
    QVector<Condition*> m_vConditions;
    QVector<RuleFormula*> m_vformula;
};

#endif // RULEBASE_H
